/**
 * 
 */
package net.sahv.bdyz.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sahv.bdyz.mapper.InformationMapper;
import net.sahv.bdyz.model.Information;
import net.sahv.bdyz.util.PageInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 张天敏
 * @date 日期：2016年8月3日 时间：下午4:25:37
 */
@Service
public class InformationService {
	
	@Autowired
	private InformationMapper informationMapper;
	
    public int deleteByPrimaryKey(Integer iId){
    	return informationMapper.deleteByPrimaryKey(iId);
    }

    public int insert(Information record){
    	return informationMapper.insert(record);
    }

    public Information selectByPrimaryKey(Integer iId){
    	return informationMapper.selectByPrimaryKey(iId);
    }

    public List<Information> selectAll(){
    	return informationMapper.selectAll();
    }

    public int updateByPrimaryKey(Information record){
    	return informationMapper.updateByPrimaryKey(record);
    }

	public List<Map<String, Object>> selectAlls(PageInfo pageInfo, String where, String order) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("myCount", pageInfo.getCount());
		param.put("pageSize", pageInfo.getPageSize());
		param.put("page", pageInfo.getPage());
		param.put("where", where);
		param.put("order", order);
		List<Map<String, Object>> m = informationMapper.selectAlls(param);
		pageInfo.setCount(Integer.parseInt(param.get("myCount").toString()));
		return m;
	}
	/**
	 * 查询咨询列表数据
	 * @param param
	 * @return
	 * 张羽鹏
	 * 2016年8月6日14:12:40
	 */
	public List<Map<String, Object>> InformationList(Map<String, Object> param) {
		return informationMapper.InformationList(param);
	}
	/**
	 * 查询资讯列表数据的数量
	 * @param where
	 * @return
	 * 张羽鹏
	 * 2016年8月6日14:13:08
	 */
	public Integer InformationListCount(String where) {
		return informationMapper.InformationListCount(where);
	}

	public List<Information> selectAllBySearch() {
		// TODO Auto-generated method stub
		return informationMapper.selectAllBySearch();
	}
}
